package com.github.cyf.controller;

import com.github.cyf.common.module.Rs;
import com.github.cyf.entity.Address;
import com.github.cyf.entity.DesensitizationEntity;
import com.github.cyf.entity.User;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @author chenyifan
 * @create 2024-03-27 13:27
 */
@RestController
@RequestMapping("/test")
@Api(tags = "测试模块")
public class TestController {

    @GetMapping("/getUser")
    public Rs getUser() {
        Address address = new Address("陕西省", "西安市");
        User user = new User(111l, "cyf", LocalTime.now(), LocalDate.now(), LocalDateTime.now(), address);
        return Rs.ok().setData(user);
    }

    @GetMapping("/desensitization")
    public Rs desensitization() {
        DesensitizationEntity entity = DesensitizationEntity.builder()
                .userName("张三")
                .password("QWE123456")
                .address("陕西省西安市长安区")
                .email("3223215962@qq.com")
                .fixedPhone("0838-5553792")
                .mobilePhone("15187177955")
                .carLicense("豫P3U253")
                .bankCard("1679374639283740")
                .idCard("412711223344556677")
                .custom("289073458794")
                .noMask("我是不需要数据脱敏的字段")
                .build();
        return Rs.ok().setData(entity);
    }
}
